package com.huifaapp.mall.adapter;

import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.huifaapp.mall.R;

import java.util.List;

/**
 * Created by duanyu on 2018/1/22.
 */

public class Red_Adapter extends RecyclerView.Adapter<Red_Adapter.MyViewHolder> {
    private List<String>list;
    private Context context;

    public Red_Adapter(Context context, List<String> list) {
        this.list = list;
        this.context = context;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View recyclerViewItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.itme_cart_red, parent, false);
        return new MyViewHolder(recyclerViewItem);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        Glide.with(context).load(list.get(position)).into(holder.crat_red);

    }

    @Override
    public int getItemCount() {
        return list.size();
    }
    public class MyViewHolder extends RecyclerView.ViewHolder {


        private final ImageView crat_red;

        public MyViewHolder(View itemView) {
            super(itemView);
            crat_red = (ImageView) itemView.findViewById(R.id.crat_red);
        }
    }

}
